<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <script>
        //1.方法一

        /*   var num1 = prompt('请输入一个数');
          var num2 = prompt('请输入第二个数');
          var num3 = prompt('请输入第三个数');
          document.write(Math.max(num1, num2, num3)); */

        //2.方法二
        var num1 = prompt('请输入一个数');
        var num2 = prompt('请输入第二个数');
        var num3 = prompt('请输入第三个数');
        var max = num1;
        if (max < num2) {
            max = num2
        }
        if (max < num3) {
            max = num3;
        }
        document.write('最大值为' + max)
    </script>
</body>

</html>